package cz.muni.fi.pa165.sportclubmanager.dao;

/**
 *
 * @author xondrusk
 */

import cz.muni.fi.pa165.sportclubmanager.entity.AgeCategory;
import cz.muni.fi.pa165.sportclubmanager.entity.Player;
import java.util.List;

public interface PlayerDAO {

    /**
     * 
     * create entry for Player in database
     * 
     * @param p Player to store
     * @throws IllegalArgumentException when p or p.lastName or p.firstName or
     *          p.birthDate is null, when height or weight is equal or less than
     *          zero, when length of p.lastName or p.firstname is grater than 255
     */
    public void create(Player p);

    /**
     * 
     * update entry for Player with given id in database 
     * 
     * @param p Player to update
     * @throws IllegalArgumentException when p or p.id or p.lastName or 
     *          p.firstName or p.birthDate is null, when height or weight 
     *          is equal or less than zero, when length of p.lastName or 
     *          p.firstname is grater than 255
     */
    public void update(Player p);

    /**
     * 
     * remove Player with given id from database
     * 
     * @param p Player to remove
     * @throws IllegalArgumentException when p or p.id is null or p.id
     *          is less than zero
     */
    public void remove(Player p);

    /**
     * 
     * find Player with given id in database
     * 
     * @param id
     * @return Player with given id
     * @throws IllegalArgumentException when id is null or id is less than zero
     */
    public Player find(Long id);
    
    /**
     * 
     * find all Players in database
     * 
     * @return all players stored in database
     */
    public List<Player> findAll();
    
    
    /**
     * Get list of players within Age category. Player is in category as specified in {@link AgeCategory}.
     * 
     * @param AgeCategory with desired values in ageFrom and ageTo fields
     * @return List of all players belonging to given Age category, no specific order,
     *         never returns null
     * @throws IllegalArgumentException when ac is null
     */
    public List<Player> getPlayersFor(AgeCategory ac);
}